from BasePage import BasePage
import time
class MessagePage(BasePage):
    _sousuo = (BasePage.ID, 'com.zoneyet.lovehottie:id/iv_search')
    _shaixuan = (BasePage.ID, 'com.zoneyet.lovehottie:id/btn_search')
    _friend = (BasePage.XPATH, '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/androidx.recyclerview.widget.RecyclerView/android.widget.LinearLayout[1]/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout')
    _hi = (BasePage.ID, 'com.zoneyet.lovehottie:id/btn_hi')
    _sendtxt = (BasePage.ID,"com.zoneyet.lovehottie:id/et_input")
    _xzfanyi = (BasePage.ID, "com.zoneyet.lovehottie:id/btn_translate")
    _bufanyi = (BasePage.ID, "com.zoneyet.lovehottie:id/btn_no_need_translate")
    _sendmsg = (BasePage.ID, "com.zoneyet.lovehottie:id/iv_send")
    _paizhaoButton = (BasePage.XPATH, "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout[2]/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/androidx.recyclerview.widget.RecyclerView/android.widget.LinearLayout[3]/android.widget.LinearLayout")
    _paisheButton = (BasePage.XPATH, "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.View")
    _xuantuSend = (BasePage.ID, "com.zoneyet.lovehottie:id/zoneyet_tv_send")
    def message_success(self,txt):
        self.click(self._sousuo)
        self.click(self._shaixuan)
        self.click(self._friend)
        time.sleep(1)
        self.click(self._hi)
        self.send_keys(self._sendtxt, txt)
        self.click(self._xzfanyi)
        self.click(self._bufanyi)
        self.click(self._sendmsg)
    def send_photo(self):
        self.click(self._sousuo)
        self.click(self._shaixuan)
        self.click(self._friend)
        time.sleep(1)
        self.click(self._hi)
        time.sleep(3)
        # 拍照发图
        self.click(self._paizhaoButton)
        self.click(self._paisheButton)
        self.click(self._xuantuSend)
